//
//  SmallPracticalCollectionCell.m
//  MyProject
//
//  Created by dllo on 15/11/1.
//  Copyright (c) 2015年 蓝鸥0825. All rights reserved.
//

#import "SmallPracticalCollectionCell.h"
#import "UIImageView+WebCache.h"


#define  WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height


@implementation SmallPracticalCollectionCell

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self create];
    }
    return self;
 
}


- (void)create{
    
    self.image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT / 3 * 2)];
    [self addSubview:self.image];
    [self.image release];
//    self.image.layer.borderWidth = 1;
    
    
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, HEIGHT / 3 * 2, WIDTH, HEIGHT / 3)];
    [self addSubview:self.label];
    [self.label release];
//    self.label.layer.borderWidth = 1;
    
}



- (void)setCanModel:(CanModel *)canModel{
    
    if (_canModel != canModel) {
        [_canModel release];
        _canModel = [canModel retain];
    }
    [self.image sd_setImageWithURL:[NSURL URLWithString:self.canModel.titlepic]placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
    self.label.text = canModel.title;
}




@end
